package com.sunlands.zlcx.usercenter.repository;

import com.sunlands.zlcx.usercenter.domain.VipUserUseRecordDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.math.BigInteger;
import java.util.List;

/**
 * @author shixiaopeng
 */
@Repository
public interface VipUserUseRecordRepository extends JpaRepository<VipUserUseRecordDO, Long> {

    @Query(value = "select DISTINCT(user_id) from tz_vip_user_use_record  p where p.set_meal_id  is null",nativeQuery = true)
    List<BigInteger> findDistinctUserIdBySql();

    List<VipUserUseRecordDO> findAllByUserIdAndLevelOrderByCreateTime(Long userId, Integer level);
}
